/*
 *  TUIO_receiver.h
 *
 *  Header of TUIO_receiver.c that monitors OSC messages
 *  received with the TUIO protocol and dispatches it to
 *  the appropriate handlers.
 *
 *  Copyright (C) 2010 LIMSI-CNRS (Orsay-France) and EFREI (Paris-France)
 *
 *  Authors: Rami Ajaj, Nicolas Flasque and Frederic Vernier.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation; either version 2.1 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  $Id$
 */

#ifndef TUIO_RECEIVER_H
#define TUIO_RECEIVER_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifndef WIN32
  #include <sys/time.h>
  #include <unistd.h>
#else
  #include <time.h>
#endif

#include "lo/lo.h"
#include "MTouchware_handlers.h"
#include "MTouchware_application.h"



/**
 * \defgroup TUIO receiver
 *
 * Handles the reception of TUIO messages and dispatches them to the appropriate handlers
 * @{
 */


/**
 * \brief Listens to OSC messages received on port TUIO_IN_PORT (default: 3333) and dispatches
 * them to the appropriate handlers.
 *
 * \return An integer specifying wether if a problem has occured or not.
 *
 */
int TUIO_receiver(char *, t_applicationData *);

/**
 * \brief Prints errors occured when receiving OSC messages.
 *
 * \param num integer specifying the error number.
 * \param m char* specifying the message.
 * \param path char* specifying the path of the received message.
 *
 */
void error(int num, const char *m, const char *path);

/**
 * \brief read_stdin.
 *
 */
void read_stdin(void);

/** @} */
#ifdef __cplusplus
}
#endif

#endif
